package com.bsh.repository;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;

import com.bsh.mybatis.IRepository.MerchantCategoryMapper;
import com.bsh.mybatis.model.MerchantCategory;

@Repository
public class DaoMerchantCategory {
	@Resource
	SqlSessionTemplate session;
	@Resource
	JdbcTemplate jdbcTemplate;
	@Resource
	NamedParameterJdbcTemplate namedJdbcTemplate;

	MerchantCategoryMapper getMapper() {
		return session.getMapper(MerchantCategoryMapper.class);
	}

	public int deleteByPrimaryKey(Integer id) {
		int res = getMapper().deleteByPrimaryKey(id);
		return res;
	}

	public int insert(MerchantCategory record) {
		int res = getMapper().insert(record);
		return record.getId();
	}

	public int insertSelective(MerchantCategory record) {
		int res = getMapper().insertSelective(record);
		return record.getId();
	}

	public MerchantCategory selectByPrimaryKey(Integer id) {
		MerchantCategory row = getMapper().selectByPrimaryKey(id);
		return row;
	}

	public int updateByPrimaryKeySelective(MerchantCategory record) {
		int res = getMapper().updateByPrimaryKeySelective(record);
		return res;
	}

	public int updateByPrimaryKey(MerchantCategory record) {
		int res = getMapper().updateByPrimaryKey(record);
		return res;
	}

	/**
	 * 读取商家类型列表
	 * 
	 * @param roleId
	 */
	public List<MerchantCategory> getMerchantCategoryList() {
		List<MerchantCategory> res = getMapper().getMerchantCategoryList();
		return res;
	}
}
